/**
 * Author@ Cheng Feitian
 * Date: 2020-3-20
 * Description: 内存四区中各个变量的区别
 */

#include <algorithm>
#include <iostream>
#include <cstring>

using namespace std;
const int maxn = 1024;
//全局常量
const int c_g_a = 10;
const int c_g_b = 10;

int g_a = 10;
int g_b = 10;

int main() {
#ifdef LOCAL
    freopen("./result/1.in", "r", stdin);
    freopen("./result/1.out", "w", stdout);
#endif
    
    cout << "全局变量g_a的地址为：" << "\t" << &g_a << endl;
    cout << "全部变量g_b的地址为：" << "\t" << &g_b << endl;

    //静态变量
    static int s_a = 10;
    static int s_b = 10;

    cout << "静态变量s_a的地址为：" << "\t" << &s_a << endl;   
    cout << "静态变量s_b的地址为：" << "\t" << &s_b << endl;

   	cout << "全局常量c_g_a地址为： " << "\t" << &c_g_a << endl;
	cout << "全局常量c_g_b地址为： " << "\t" << &c_g_b << endl;

    //字符串常量
 	cout << "字符串常量地址为： " << "\t" << &("Hello World!") << endl;

    const int c_l_a = 10;
	const int c_l_b = 10;
	cout << "局部常量c_l_a地址为： " << "\t" << &c_l_a << endl;
	cout << "局部常量c_l_b地址为： " << "\t" << &c_l_b << endl;

    int a = 10;
    int b = 10;
    cout << "局部变量a的地址为："<< "\t" << &a << endl;
    cout << "局部变量b的地址为：" << "\t" << &b << endl;
    
    return 0;
}